package com.kaifamiao.demo.d0804;

public class Demo03 {

    public static void main(String[] args) {
        String str = "  你好  你好  ";

        System.out.println(str.length());

//        String str1 = str.strip();
        String str1 = str.trim();
        System.out.println(str1.length());
        System.out.println(str1);


        str = "abcdefg";

        // 5 - 2 = 3
        // str.substring(2, 5);
        CharSequence s = str.subSequence(2, 5);
        System.out.println(s); // cde

        // 从索引 2 开始到结束
        String ss = str.substring(2);
        System.out.println(ss);
    }
}
